<?php

class MHtmlElement {
    const EOL = "\n";
    const TAB = "\t";
    
    protected $_htmlOptions = array();

    public function setHtmlOption($key, $value) {
        if (is_scalar($value)) {
            $this->_htmlOptions[$key] = $value;
        }
        return $this;
    }

    public function getHtmlOption($key) {
        return (isset($this->_htmlOptions[$key])) ? $this->_htmlOptions[$key] : NULL;
    }

    public function removeHtmlOption($key){
        unset($this->_htmlOptions[$key]);
    }

    public function renderHtmlOptions() {
        $return = '';
        foreach ($this->_htmlOptions as $key => $value) {
            $return .= ' ' . $key . '="' . $value . '"';
        }
        return $return;
    }

    public function setId($id){
        $this->setHtmlOption('id', $id);
        return $this;
    }

    public function getId(){
        return $this->getHtmlOption('id');
    }
}

?>
